/**
 * 处理提现申请js
 */
var Windex = parent.layer.getFrameIndex(window.name);
$(function(){
	$('input[type="radio"]').iCheck({radioClass: 'iradio_square-green'});
	
	$("#withdrawAuditForm").validate({
		rules : {
			withdrawStatus : {
				required : true
			},
			rejectReason : {
				required : true
			}
		},
		messages : {
			withdrawStatus : {
				required : '请填处理结果'
			},
			rejectReason : {
				required : '请填写备注信息'
			}
		},
		errorPlacement : function(error, element) { // 错误信息位置设置方法
			var tagName = $(element).is("select");
    		if(!tagName) {
    			error.insertAfter(element);
    		}else {
    			error.insertAfter(element.parent().next());
    		}
		},
		submitHandler : function(form) {
			$(form).ajaxSubmit({
		       	type		: 'post',
		       	//url		: url, 
		       	clearForm	: false,  
				resetForm	: false,  
				timeout		: 2000, 
		       	success		: function(json){
	       	        //返回结果 {"code":23,"msg":"新增商品品牌成功"}
                    var index = parent.layer.getFrameIndex(window.name);
                    if(json.code == '0') {
                        parent.$('#opt_status').val('0'); 
                        showErr(json.msg); 
                    } else {
                        parent.$('#opt_status').val('1'); 
                        parent.layer.close(index);
                    }
		     	}
			}); 
		}
	});
	
	//提交
	$("#btn_save").click(function() {
		$("#withdrawAuditForm").submit();
		return false;
	});
	
	//点击返回事件
	$("#btn_back").on('click', function() {
   		parent.$('#layer_opt_status').val('0'); 
   		parent.layer.close(Windex);
	});
})